package ${packageName};



import ${basePackage}.service.${entityName}Service;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.http.MediaType;

import java.util.List;

/**
* ${tableComment}控制层
* ${author}
* ${now}
*/
@Slf4j
@RestController
@Tag(name="${tableComment}接口")
@RequestMapping("/${entityName?uncap_first}")
public class ${entityName}Controller {

    @Resource
    private ${entityName}Service ${entityName?uncap_first}Service;


    @Operation(summary = "分页条件查询")
    @PostMapping(value = "/get/list/page", produces = MediaType.APPLICATION_JSON_VALUE)
    public ResultDTO<List<${entityName}DTO>> selectListPage(@RequestBody ${entityName}PageQueryDTO dto) {
        return ${entityName?uncap_first}Service.selectListPage(dto);
    }

    @Operation(summary = "条件查询")
    @PostMapping(value = "/get/list", produces = MediaType.APPLICATION_JSON_VALUE)
    public ResultDTO<List<${entityName}DTO>> selectList(@RequestBody ${entityName}DTO dto) {
        List<${entityName}DTO> list = ${entityName?uncap_first}Service.selectList(dto);
        return ResultDTO.ok(list);
    }

    @Operation(summary = "保存")
    @PostMapping(value = "/save", produces = MediaType.APPLICATION_JSON_VALUE)
    public ResultDTO<${entityName}DTO> save(@RequestBody @Validated ${entityName}DTO dto) {
        return ResultDTO.ok(${entityName?uncap_first}Service.save(dto));
    }

    @Operation(summary = "逻辑删除")
    @PostMapping(value = "/delete", produces = MediaType.APPLICATION_JSON_VALUE)
    public ResultDTO<${entityName}DTO> delete(@RequestBody ${entityName}DTO dto) {
        return ResultDTO.ok(${entityName?uncap_first}Service.delete(dto));
    }



}